package com.yc.http.d0704;

public class CookieServlet extends HttpServlet{

    @Override
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException {
        // Cookie 在浏览器端保存少量用户数据的技术
        // 浏览器在每次发送请求到服务器时, 会自动的待会cookie数据

        Cookie[] cookies = request.getCookies();

        for (int i = 0; i < cookies.length; i++) {
            response.getWriter().append(cookies[i].toString() + "<br>");
        }

        // 只能使用英文
        Cookie cookie1 = new Cookie("name1","zhangsan");
        Cookie cookie2 = new Cookie("name2","zhangsan");
        response.addCookie(cookie1);
        response.addCookie(cookie2);


    }
}
